<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECSHOP 管理中心 - 友情链接列表 </title>
<base href="__STATIC__/Admin/">
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<style>
  .panel-icloud .panel-right iframe {
    height: 300px;
    margin-top: 15px;
  }
  .panel-hint{
    top: 0%;
  }
  .lname:hover{
      background: #ccc;
  }
</style>


</head>
<body>
<!--遮罩-->
<div class="mask-black" id="CMask"></div>
<!--遮罩-->
<h1>
      <span class="action-span"><a class="btn btn-right" href="{:url('Admin/System/link_add')}">添加新链接</a></span>
    <span class="action-span1"><a href="{:url('Admin/Index/main')}">ECSHOP 管理中心</a> </span>
    <span id="search_id" class="action-span1">&nbsp;&nbsp;>&nbsp;&nbsp;友情链接列表 </span>
  <div style="clear:both"></div>
</h1>
<div class="list-div" id="listDiv">

<table cellpadding="3" cellspacing="1">
  <tr>
    <th>链接名称</th>
    <th>链接地址</th>
    <th>链接LOGO</th>
    <th>显示顺序</th>
    <th>操作</th>
  </tr>
{foreach $list as $v}
  <tr>
    <tr>
    <td class="first-cell" align="center"><span class="lname" id="{$v.link_id}" title="点击修改">{$v.link_name}</span></td>
    <td align="center"><span><a href="http://www.wdwd.com/" target="_blank">{$v.link_url}</a></span></td>
    <td align="center"><span><img src='__ROOT__{$v.link_logo}' width=88 height=31 /></span></td>
    <td align="center"><span>{$v.show_order}</span></td>
    <td align="center"><span><a href="javascript:;" title="移除" class="sc" id="{$v.link_id}">移除</a></span></td>
  </tr>
{/foreach}
</table>

</div>
<div>{$list->render()}</div>
<div id="footer">版权所有 &copy; 2005-2018 上海商派软件有限公司，并保留所有权利。</div>
</body>
<script src="jquery.js"></script>
<script>
    $(".lname").on('click',function(){
    var td = $(this).parent();
    var id = $(this).attr('id');
    var lname = $(this).text();
    td.children().html('<input type="text" id="input">');
    $('#input').val('').focus().val(lname);
    $('#input').blur(function(event) {
      var text = $(this).val();
      td.children().html('<span class="lname" id="'+id+'">'+text+'</span>');
       $.ajax({
            url: "{:url('Admin/System/link_save')}",
            type: 'get',
            dataType: 'json',
            data: {id:id,lname:text},
            success:function(e){
              if (!e) {
                 history.go(0);
              }
            }
        })
      });
    });

    $(".sc").on('click',function(){
          var id = $(this).attr('id');
          $.ajax({
              url:"{:url('Admin/System/link_del')}",
              type:"get",
              data:{id:id},
              dataType:'json',
              success:function(e){
                if(e.code==1){
                    alert(e.msg);
                    history.go(0)
                }else if(e.code==0){
                    alert(e.msg);
                    history.go(0)
                }
              }
          });
      });

</script>
</html>